﻿<UserControl x:Class="HM.UI.UserControls.HomeTab"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             Height="Auto" Width="Auto">
    
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

            <!--Headers-->
            <TextBlock  Grid.Row="0" Grid.Column="0"
                        Text="{DynamicResource add_payment}"
                        FontWeight="Light"
                        Opacity=".5"
                        FontSize="18"
                        Margin="10" />

            <TextBlock
                    Grid.Row="0"
                    Grid.Column="1"
                    Text="{DynamicResource add_expense}"
                    FontWeight="Light"
                    Opacity=".5"
                    FontSize="18"
                    VerticalAlignment="Bottom"
                    Margin="10"/>

            <!--Add Payment-->
            <Grid Grid.Row="1" Grid.Column="0">
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="200" />
                </Grid.ColumnDefinitions>

                <!--Labels-->
                <TextBlock
                        Grid.Column="0"
                        Grid.Row="0"
                        Text="{DynamicResource amount}"
                        VerticalAlignment="Center"
                        Margin="10"/>
                <TextBlock
                        Grid.Column="0"
                        Grid.Row="1"
                        Text="{DynamicResource date}"
                        VerticalAlignment="Center"
                        Margin="10"/>
                <TextBlock
                        Grid.Column="0"
                        Grid.Row="2"
                        Text="{DynamicResource tenant}"
                        VerticalAlignment="Center"
                        Margin="10"/>

                <!--Controls-->
                <TextBox
                        Grid.Column="1"
                        Grid.Row="0"
                        Text="{Binding PaymentAmount, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                        Margin="10" />
                <DatePicker
                        Grid.Column="1"
                        Grid.Row="1"
                        SelectedDate="{Binding PaymentDate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                        Margin="10"/>
                <ComboBox
                        Grid.Column="1"
                        Grid.Row="2"
                        ItemsSource="{Binding Tenants, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                        DisplayMemberPath="Name"
                        SelectedItem="{Binding SelectedTenant}"
                        Margin="10" />
            </Grid>

            <!--Button-->
            <Button
                    Grid.Column="0"
                    Grid.Row="2"
                    Width="Auto"
                    Command="{Binding AddPayment}"
                    Content="{DynamicResource add}"
                    Margin="10">
            </Button>

            <!--Add Expense-->

            <Grid Grid.Row="1" Grid.Column="1" Background="DarkGray">
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="150" />
                </Grid.ColumnDefinitions>

                <!--Labels-->
                <TextBlock
                        Grid.Column="0"
                        Grid.Row="0"
                        Text="{DynamicResource amount}"
                        VerticalAlignment="Center"
                        Margin="10" />
                <TextBlock
                        Grid.Column="0"
                        Grid.Row="1"
                        Text="{DynamicResource description}"
                        VerticalAlignment="Center"
                        Margin="10"/>
                <TextBlock
                        Grid.Column="0"
                        Grid.Row="2"
                        Text="{DynamicResource custom_description}"
                        VerticalAlignment="Center"
                        Margin="10"/>

                <!--Controls-->
                <TextBox
                        Grid.Column="1"
                        Grid.Row="0"
                        Text="{Binding ExpenseAmount, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                        Margin="10"
                        VerticalAlignment="Center"/>

                <ComboBox
                        Grid.Column="1"
                        Grid.Row="1"
                        Margin="10"
                        ItemsSource="{Binding RegularExpenses}"
                        SelectedItem="{Binding SelectedRegularExpense, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                        DisplayMemberPath="Description"/>

                <TextBox
                        Grid.Column="1"
                        Grid.Row="2"
                        Text="{Binding ExpenseDescription, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                        Margin="10" />
            </Grid>

            <!--Button-->
            <Button
                    Grid.Row="2"
                    Grid.Column="1"
                    Margin="10"
                    Command="{Binding AddExpense}"
                    Content="{DynamicResource add}"/>

            <!--Cash Display-->
            <StackPanel Grid.Row="3" HorizontalAlignment="Right" Grid.ColumnSpan="2">
                <Label
                        Content="{Binding Cash, NotifyOnTargetUpdated=True, NotifyOnSourceUpdated=True}"
                        Margin="10"
                        Foreground="Gray" />
                <Label
                        Content="{Binding CashThisMonth}"
                        Margin="10"
                        Foreground="Gray" />
            </StackPanel>
        </Grid>
</UserControl>
